home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
demo
/
mag
/
trash3_2.lha
/
fuentes
/
STARTUP-FUENTES.lha
/
Start500.s
< prev
next >
Wrap
Text File
|
1996-12-07
|
11KB
|
399 lines
;-----------------------------------------
;
; Generic Demo Startup Code version 1.06
; Coded by Flynn/Capsule in 1996.
;
; * Works on ALL Amigas.
; * Special A500 version for Sapphire/Centolos
; * Full 68000 - 68060 support.
;
;-----------------------------------------
INCLUDE Include:macros/macros.i
IFD _PHXASS_ ;
MACHINE 68030 ; Comentar estas lineas para DevPac o
ENDIF ; AsmOne, solo son para PHXAss
section startup,code
Start
;-----------------
; Processor check.
;-----------------
move.l 4.w,a6 ; exec base.
move.w $128(a6),d0 ; AttnFlags
lea _cpu,a1
lea _status,a2
lea _warning,a3 ; Warning flag for 68000
btst #0,d0
bne.s _010 ; 68010
move.b #"0",(a1)
move.w #$FF,(a3) ; Set warning flag for 68000 processor.
bra.b _done
_010 btst #1,d0
bne.s _020 ; 68020
move.b #"1",(a1)
; move.w #"ER",(a2) ; Don't cause error flag if 68010 found.
bra.b _done
_020 btst #2,d0
bne.s _030 ; 68030
move.b #"2",(a1)
bra.b _done
_030 btst #3,d0
bne.s _040 ; 68040
move.b #"3",(a1)
bra.b _done
_040 btst #7,d0
bne.s _060 ; 68060
move.b #"4",(a1)
bra.b _done
_060 move.b #"6",(a1)
_done bsr AbrirDOS ; open DOS.library
WRITE _header,_stdout ; write header
bsr AGA_Check ; Check for AGA chip set
cmp.l #"AGA.",d7
bne _notaga
WRITE _aga,_stdout
bra _continue
_notaga WRITE _not_aga,_stdout
_continue
move.l 4.w,a6
cmp.b #50,530(A6) ; Check for PAL/NTSC
bne _nopal
WRITE _pal,_stdout
bra _cont2
_nopal lea _status,a2
move.w #"ER",(a2)
WRITE _ntsc,_stdout
bra _failed
_cont2
lea _status,a2
cmp.w #"ER",(a2)
bne _systemok
_failed
WRITE _abort1,_stdout
bsr CerrarDOS ; cerramos librería DOS
moveq #0,d0 ; retorno al Shell sin error
rts ; retorno
_systemok
;Now we can check for chip/fast memory...
lea _chipmem,a2
move.l 4.w,a6 ; exec base
move.l #$00020002,d1 ; chip mem
jsr -216(a6) ; _LVOAvailMem
move.l d0,(a2)+
move.l #$00020004,d1 ; fast mem
jsr -216(a6) ; _LVOAvailMem
move.l d0,(a2)
; And now let's convert the data into ASCII...
lea _chipmem,a2
lea _cmem,a3 ; string pointer
lea _values,a4 ; Table for Hex-Ascii conversion
move.l (a2)+,d0 ; amount of chip mem
bsr converter ; do conversion.
move.l (a2),d0 ; amount of fast mem
lea _fmem,a3 ; string pointer
bsr converter ; convert values
WRITE _chip,_stdout
_fast_ok
WRITE _passd,_stdout
bsr CerrarDOS ; close dos.library
;--------------------------------------------------
; Close system and store old IRQ/DMA/Copper values.
;--------------------------------------------------
lea gfx_lib,a1 ; open graphics.library
moveq #0,d0
move.l 4.w,a6 ; exec base
jsr -552(a6) ; _LVOOpenLibrary
move.l d0,_gfxbase ; store open gfxlibrary pointer
move.l d0,a6
move.l 38(a6),_oldcopper ; store old copper list address
move.l 34(a6),_oldview ; store old WB view.
jsr -228(a6) ; _LVOWaitBlitt
jsr -456(a6) ; _LVOOwnBlitter
moveq #0,d7
move.l d7,a1
jsr -222(a6) ; _LVOLoadView(Null)
jsr -270(a6) ; _LVOWaitTOF
jsr -270(a6) ; _LVOWaitTOF
move.l 4.w,a6
jsr -132(a6) ; _LVOForbid
lea _warning,a3
cmp.w #$FF,(a3)
beq.b _avoid ; avoid a complete hang up on 68000
lea GetVBR(pc),a5
jsr -$1e(a6) ; _LVOSupervisor
_avoid
move $DFF01C,_intenar
move $DFF01E,_intreqr
move $DFF002,_dmaconr
move $DFF010,_adkconr
move #%0111111111111111,$DFF09A ; Intena
move #%1100000000100000,$DFF09A ; enable needed IRQs
move.l _gfxbase,a6
jsr -270(a6) ; WaitTOF
move #%0111111111111111,$DFF096 ; DMACONW
move #%1000001111000000,$DFF096
move.l _vectorbase,a0
move.l $6c(a0),_int3save ; store original vblank int.
jsr _maincode ; call main demo code
move.l _vectorbase,a0
move.l _int3save,$6c(a0) ; restore old level3 int.
move _intenar,d7
bset #$f,d7
move d7,$DFF09A ; restore old interrupts.
move _intreqr,d7
bset #$f,d7
move d7,$DFF09C ; the same...
move _dmaconr,d7
bset #$f,d7
move d7,$DFF096 ; restore old DMAs
move _adkconr,d7
bset #$f,d7
move d7,$DFF09E ; restore Adkcon
move.l _gfxbase,a6
move.l _oldview,a1
jsr -222(a6) ; _LVOLoadview(OldView)
move.l _oldcopper,$dff080 ; restore old copper list.
jsr -462(a6) ; _LVODisownBlitter
move.l 4.w,a6
move.l _gfxbase,a1
jsr -414(a6) ; close graphics.library
jsr -138(a6) ; _LVOPermit
moveq #0,d0
rts
;--------------------------------------------------------------------
; Hex to Ascii conversion routine.
; IN: D0.l = Number, A3 = Pointer to string, A4 = Pointer to _values.
;--------------------------------------------------------------------
converter
move.l d0,d6 ; store number.
moveq #28,d7 ; bits to be shifted.
do_conv
lsr.l d7,d0 ; d0.b is now MSB
and.w #$000F,d0
move.b (A4,d0.w),(a3)+ ; Copy value to string.
move.l d6,d0
subq.w #4,d7
cmp.w #-4,d7
bne do_conv
rts
;-------------------------
; AGA chipset tester.
; Setpatch MUST be loaded!
;-------------------------
AGA_Check
lea gfx_lib,a1
moveq #0,d0
move.l 4.w,a6
jsr -552(a6)
btst #2,$EC(A0)
bne.s is_aa
moveq #0,d7
bra.s not_aga
is_aa move.l #'AGA.',d7
not_aga move.l a0,a1
jsr -414(a6)
rts
;--------------------------------------
; Store VBR value.
; Processor MUST be in Supervisor mode.
;--------------------------------------
GetVBR movec VBR,D0
lea _vectorbase,a0
move.l d0,(a0)
RTE
;-------------------
; dos.library stuff.
;-------------------
AbrirDOS:
move.l _AbsExecBase,_ExecBase ; store exec base
lea dos_name,a1 ; dos.library
moveq #0,d0 ; any version
CALLSYS OpenLibrary,_ExecBase
move.l d0,_DOSBase ; store Dos.library pointer
beq ERROR
CALLSYS Output,_DOSBase ; output descriptor.
move.l d0,_stdout ; store descriptor.
beq CerrarDOS
CALLSYS Input,_DOSBase ; input descriptor.
move.l d0,_stdin
beq CerrarDOS
rts
CerrarDOS:
move.l _DOSBase,a1 ;
CALLSYS CloseLibrary,_ExecBase ;close dos.library
rts
ERROR: clr.l d0 ; exit to shell in case of error.
rts
;------------------------------------------------------------------------
; Text and misc data for startup/restore routines.
;------------------------------------------------------------------------
section stup_data,data
_stdout ds.l 1
_stdin ds.l 1
_ExecBase ds.l 1
_DOSBase ds.l 1
_status dc.w 0
_warning dc.w 0 ; Will be set to $FF if 68000 to avoid
; an attempt to read the VBR register.
_values dc.b '0123456789ABCDEF'
_chipmem dc.l 0
_fastmem dc.l 0
_gfxbase dc.l 0
_oldcopper dc.l 0
_oldview dc.l 0
_vectorbase dc.l 0
_intenar dc.w 0
_intreqr dc.w 0
_dmaconr dc.w 0
_adkconr dc.w 0
_int3save dc.l 0
dos_name dc.b "dos.library",0
gfx_lib dc.b "graphics.library",0,0
_header dc.b LF,' Hardware Configuration Test 1.06 © 1996 Capsule '
dc.b LF,' -----------------------------------------------',LF
dc.b LF,' 680'
_cpu dc.b 'x0 processor found.'
_header_long EQU *-_header
_aga dc.b LF,' AGA chipset found.'
_aga_long EQU *-_aga
_not_aga dc.b LF,' OCS/ECS chipset found.'
_not_aga_long EQU *-_not_aga
_pal dc.b LF,' PAL display.'
_pal_long equ *-_pal
_ntsc dc.b LF,' System is not PAL.'
_ntsc_long EQU *-_ntsc
_chip dc.b LF,LF,' Chip Memory: $'
_cmem dc.b '00000000 bytes available.'
dc.b LF,' Fast Memory: $'
_fmem dc.b '00000000 bytes available.'
_chip_long equ *-_chip
_abort1 dc.b LF,LF,' Hardware test failed. Program aborted...',LF,LF
_abort1_long EQU *-_abort1
_abort2 dc.b LF,LF,' Sorry, this demo requires some FAST memory.'
dc.b LF,LF
_abort2_long EQU *-_abort2
_passd dc.b LF,LF,' Hardware test passed. Running demo...',LF,LF
_passd_long EQU 42
;----------------------------------------------------------------------------
; Real code starts here if everything went ok.
;----------------------------------------------------------------------------
section democode,code
_maincode nop
rts